<div class="dux-tools">
  <div class="bread-head">TAG分组管理 <span class="small">管理TAG所属分类</span> </div>
  <br>
  <div class="tools-function clearfix">
  <?php if(model('user_group')->model_power('tags','visit')){ ?>
    <div class="float-left"> <a class="button button-small bg-main icon-list" href="__URL__"> TAG管理</a> </div>
    <?php } ?>
    <div class="button-group float-right"> <a class="button button-small bg-dot icon-plus dropdown-toggle"> 添加TAG分组 <span class="downward"></span></a>
      <ul class="drop-menu pull-right">
        <?php if(model('user_group')->model_power('tags','class_config')){ ?>
        <li><a href="javascript:;" onClick="add()">添加TAG组</a></li>
        <?php } ?>
      </ul>
    </div>
  </div>
</div>
<div class="admin-main"> 
  <div class="panel dux-box">
    <div class="table-responsive">
      <table id="table" class="table table-hover ">
        <tbody>
          <tr>
            <th width="80">编号</th>
            <th width="*">名称</th>
            <th width="150">操作</th>
          </tr>
          <!--foreach:{$list $vo}-->
          <tr>
            <td>{$vo.cid}</td>
            <td>{$vo.name}</td>
              <td>
                <a class="button bg-blue button-small icon-pencil" href="javascript:;" onclick="edit({$vo.cid})" title="修改"></a>
                <a class="button bg-red button-small icon-trash-o js-del"  href="javascript:;" onclick="del({$vo.cid},this)" title="删除"></a></td>
          </tr>
          <!--{/foreach}-->
        </tbody>
      </table>
    </div>
  </div>
</div>
<script>
function add() {
	urldialog({
	title:'添加TAG组',
	url:'__URL__/category_add'
	});
};
//修改
function edit(cid) {
	urldialog({
	title:'字段编辑',
	url:'__URL__/category_edit/cid-'+cid
	});
};
//删除
function del(cid,obj) {
	var obj;
	ajaxpost({
		name:'删除此分组将会把此分组下的TAG归类到无分组！ ',
		url:"__URL__/category_del",
		data:{cid: cid},
		tip:1,
		success:function(){
			$(obj).parent().parent().remove();
		}
	});
}
//选择
function selectall(name){   
    $("[name='"+name+"']").each(function(){//反选   
    if($(this).attr("checked")){   
          $(this).removeAttr("checked");   
    }else{   
          $(this).attr("checked",'true');   
    }   
    })  
}
//批量操作
function delall(){
	var str="";
	$("[name='id[]']").each(function(){//反选   
    if($(this).attr("checked")){
		  str+=$(this).val()+","; 
    }
    })
	
	ajaxpost({
		name:'您确认要继续进行操作吗？操作将无法撤销！',
		url:"__URL__/del",
		data:{id:str},
		tip:1,
		success:function(){
			window.location.reload();	
		}
	});
}
</script>